<!doctype html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
		<title>report</title>
		<link rel="stylesheet" type="text/css" href="../css/api.css" />
		<link rel="stylesheet" type="text/css" href="../css/common.css" />
		<link rel="stylesheet" type="text/css" href="../css/report.css" />
	</head>
	<body>
		<div id="wrap">
			<div id="main">
				<div class="hp_input one">
					<span class="title">手机号码:</span>
					<input type="text" id="phoneNumber" value="">
					</input>
				</div>
				<button tapmode="buttonActive" class="button blue" id="comfirm" onclick="next()">
					完成
				</button>
			</div>
		</div>
	</body>
	<script type="text/javascript" src="../script/api.js"></script>
	<script type="text/javascript" src="../script/constants.js"></script>
	<script>
		var newUser = 1;
		apiready = function() {
			newUser = api.pageParam.newUser;
		};
		function next() {
			
			var phoneNumber = $api.byId('phoneNumber').value;
			//客户端判断的用户名是否空
			if (!(phoneNumber && $api.trimAll(phoneNumber))) {
				api.alert({
					msg : '请输入手机号码!'
				});
				return;
			}
			api.ajax({
				url : USER_URL + "?cmd=checkUser", 
				method : 'post',
				cache : false,
				timeout : 3000,
				data : {
					values : {
						newUser : newUser,
						phoneNumber : phoneNumber
					}
				}
			}, function(ret, err) {
				if (ret) {
					if (ret.resultCode == RESULT_CODE_SUCCESS) {
						openWin('register1','验证码',phoneNumber);
					} else {
						api.alert({
							msg : ret.resultMessage
						});
					}
				} else {
					api.alert({
						msg : "网络或者服务器有问题!"
					});
				};
			});
		}
		
		function openWin(type,title,phoneNumber){
			api.openWin({
				name : type,
				url : 'framework.html',
				pageParam : {
					'index' : 0,
					'depName' : title,
					'type':type,
					'phoneNumber' : phoneNumber,
					'newUser' : newUser
				},
			});
		}
	</script>
</html>